<?php
/**
 * Security Configuration
 * Rate limiting and security settings
 */

return [
    /**
     * Rate Limiting Configuration
     */
    'rate_limit' => [
        'default' => [
            'limit' => env('RATE_LIMIT_DEFAULT', 100),      // requests per window
            'window' => env('RATE_LIMIT_WINDOW', 3600),     // 1 hour in seconds
        ],
        'auth' => [
            'limit' => env('RATE_LIMIT_AUTH', 10),          // login attempts per window
            'window' => env('RATE_LIMIT_AUTH_WINDOW', 300), // 5 minutes
        ],
        'api' => [
            'limit' => env('RATE_LIMIT_API', 1000),         // requests per window
            'window' => env('RATE_LIMIT_API_WINDOW', 3600),   // 1 hour
        ],
        'sensitive' => [
            'limit' => env('RATE_LIMIT_SENSITIVE', 20),    // requests per window
            'window' => env('RATE_LIMIT_SENSITIVE_WINDOW', 60), // 1 minute
        ]
    ],
    
    /**
     * Security Configuration
     */
    'security' => [
        'max_failed_attempts' => env('SECURITY_MAX_FAILED_ATTEMPTS', 5),      // Max failed login attempts
        'lockout_duration' => env('SECURITY_LOCKOUT_DURATION', 1800),         // 30 minutes lockout
        'suspicious_activity_threshold' => env('SECURITY_SUSPICIOUS_THRESHOLD', 10), // Requests per minute threshold
        'block_duration' => env('SECURITY_BLOCK_DURATION', 3600),              // 1 hour block
        'enable_ip_blocking' => env('SECURITY_ENABLE_IP_BLOCKING', true),
        'enable_user_agent_check' => env('SECURITY_ENABLE_USER_AGENT_CHECK', true),
        'enable_brute_force_protection' => env('SECURITY_ENABLE_BRUTE_FORCE', true),
    ],
    
    /**
     * API Optimization Configuration
     */
    'optimization' => [
        'cache_ttl' => [
            'stats' => env('CACHE_TTL_STATS', 300),      // 5 minutes for statistics
            'apps' => env('CACHE_TTL_APPS', 900),        // 15 minutes for app lists
            'default' => env('CACHE_TTL_DEFAULT', 600),  // 10 minutes default
        ],
        'slow_request_threshold' => env('SLOW_REQUEST_THRESHOLD', 2.0), // seconds
        'enable_compression' => env('ENABLE_COMPRESSION', true),
    ],
    
    /**
     * Performance Monitoring Configuration
     */
    'performance' => [
        'enable_metrics' => env('ENABLE_PERFORMANCE_METRICS', true),
        'metrics_ttl' => env('PERFORMANCE_METRICS_TTL', 3600), // 1 hour
        'health_check_interval' => env('HEALTH_CHECK_INTERVAL', 60), // 1 minute
    ]
];